package com.atguigu.gmall.common.config.retryer;

import feign.RetryableException;
import feign.Retryer;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Retryer3 implements Retryer {

    @Override
    public void continueOrPropagate(RetryableException e) {

        int count = 3;
        int num = 1;
        if (num <=count){
            log.info("第{}次重试",num);
            num++;
        }else {
            throw e;//不重试就抛出异常
        }
    }

    @Override
    public Retryer clone() {
        return new Retryer3();
    }
}
